<?php

namespace App\Http\Controllers\Api;

use App\Models\ChinaArea;
use App\Services\Api;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class AddressController extends Controller
{
    /**
     * 省市县三级联动
     */
    public function getAddress(Request $request)
    {
        $code = $request->post('code', '100000');

        $checked = ChinaArea::whereCode((int)$code)->first();

        return Api::success($checked->children);
    }
}
